<?php
include 'controlador.php';

$c = new Controller();
$con = $c->checkSession();
?>
<html>
    <head>
        <title>
            <?php
            echo $c->getTitle(0);
            ?>
        </title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <link href="http://fonts.googleapis.com/css?family=Arvo" rel="stylesheet" type="text/css" />
        <link href="style.css" rel="stylesheet" type="text/css" media="screen" />
    </head>
    <!--<IMG border="0" align="middle" height="141" width="1350" src="images/head.jpg"> -->
    <body>

        <div id="wrapper">
            <div id="header">
                <div id="logo">			
                    <h1><a>
                            <?php
                            echo $c->getTitle(0);
                            ?>
                        </a></h1>
                    <p><a> 
                            <?php
                            echo $c->getTitle(1);
                            ?>			 
                        </a></p>
                </div>

            </div>
            <!-- end #header -->
            <div id="menu">
                <ul>
                    <li class="current_page_item"><a href="<?php echo $c->f_action(0); ?>"><img src="images/salir.png"/><?php echo $c->getLink(0); ?></a></li>			
                </ul>
            </div>

            <!-- end #menu -->
            <div id="page">
                <div id="page-bgbtm">
                    <div id="content">
                        
                        <?php
                                        if (isset($_POST['id_ciclo'])) $ciclo = $_POST['id_ciclo'];
                                        $ConnexionPDO = $con;
                                        $ConnexionPDO->query("SET NAMES 'utf8'");
                                        $req = "select id_ciclo, nombre_ciclo from ciclo";
                                        $resultat = $ConnexionPDO->query($req);
                                        
                                        echo "<form name='form_add' method='post' action='" . $_SERVER['PHP_SELF'] . $link . "'><table>";
                                        echo "<tr>";
                                        echo "<td>CICLO</td>"; //$this->TextFormat($col)
                                        echo "<td>:</td>";                                        
                                        
                                        echo "<td><SELECT name='id_ciclo' onChange = 'document.form_add.submit()' >";
                                        $cont = 0;
                                        foreach ($resultat as $row){
                                            if(($row[0] == $ciclo)){
                                            echo '<option value="' . $row[0] . '" selected="selected">' . $row[1] . '</option>';
                                            $nombre_ciclo = $row[1];
                                            }
                                            else if(($cont == 0)){
						echo '<option value="-1" selected="selected"></option>';
						echo '<option value="' . $row[0] . '">' . $row[1] . '</option>';
						}
                                            else
						echo '<option value="' . $row[0] . '">' . $row[1] . '</option>';
                                            $cont++;
                                        }
                                        echo "</SELECT></td>";
                                        echo "</tr>";               
                                                                                
        
                                echo "<td></td>";
                                echo "<td><input type='hidden' name='' value='add' /></td>";                                
                                echo "</table></form>";                                         
                                        
                                        ?>

                        <div class="post">
                            <h2 class="title">Horarios de cursos:</h2>   
                            <p class="meta"/>
                            <div class="entry">
                                <div class="entry-bgtop">
                                    <div class="entry-bgbtm">
                                        <?php
                                        echo '<p><a href="rep_cursos.php?ciclo='. $ciclo.'"><img src="images/icon_pages.png" alt="Ir"/>&nbsp;&nbsp;Reporte de horarios</a></p>';
                                        echo '<p><a href="rep_horarioxdocente.php?ciclo='. $ciclo.'"><img src="images/icon_pages.png" alt="Ir"/>&nbsp;&nbsp;Reporte de horarios por docente</a> </p>';                                        
                                        ?>                                                                                                                   
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="post">                            
                            <h2 class="title">Plazas para contratación:</h2>
                            <p class="meta"/>
                            <div class="entry">
                                <div class="entry-bgtop">
                                    <div class="entry-bgbtm">
                                        <?php
                                        $ConnexionPDO = $con;
                                        $ConnexionPDO->query("SET NAMES 'utf8'");
                                        $req = "select * from tipo_plaza";
                                        $resultat = $ConnexionPDO->query($req);
                                        foreach ($resultat as $row){                                            
                                            echo '<p><a href="rep_presupuesto.php?pres='.$row[0].'"><img src="images/icon_pages.png" alt="Ir"/>&nbsp;&nbsp;'.$row[1].'</a></p>';
                                        }
                                        
                                        ?>
                                    </div>
                                </div>
                            </div>

                        </div> 

                        <div style="clear: both;">&nbsp;</div>
                    </div>
                    <!-- end #content -->
                    <div id="sidebar">
                        <?php echo $c->getOpciones(); ?>
                    </div>
                    <!-- end #sidebar -->
                    <div style="clear: both;">&nbsp;</div>
                </div>
            </div>
            <!-- end #page -->
        </div>	
        <div id="footer">
            <p><?php echo $c->getTexto(7); ?></p>
        </div>
    </body>
</html>
